package cn.hxzy.common.exception;


import cn.hxzy.common.response.R;
import cn.hxzy.common.response.StatusEnum;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 创建时间:2024-04-17 11:38:40 星期三
 * controller统一异常处理
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    //全局
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public <T> R<T> a(Exception e){
        return R.error(StatusEnum.SERVICE_ERROR.code,e.getMessage());
    }


}
